Local Space
Local space defines the location and dimensions of a shape after it has been modified by the mapping property of its associated transform object. Because mappings can translate, scale, rotate, skew, and otherwise distort geometries, the dimensions of a shape in local space can be quite different from what they are in geometry space.As the first stage of drawing a shape, QuickDraw GX modifies the shape's geometry by applying information from the style object attached to the shape, and then applying first the clip and then the mapping contained in the transform object attached to the shape. Applying the mapping converts the shape from geometry space to local space. Because the transform clip is applied before the transform mapping, the dimensions of the clip shape are considered to be in geometry space. When you define the clip of a transform object, you size it and position it in terms of the dimensions of the shape's geometry.
The left side of Figure 7-15 shows the same vase shape as in Figure 7-14, this time after the transform clip has been applied to it. At this point the shape is still in geometry space--its overall position and dimensions unchanged, but its appearance modified by the clip.
Figure 7-15 Applying the transform's clip and mapping to a shape
The right side of Figure 7-15 shows the vase shape after the transform mapping has been applied to it. In this particular example, the only effect of the transform mapping is to scale the shape by a factor of 2.0 in the vertical direction, about an origin at (0.0, 0.0) in geometry space. The vase is now in local space.
Local space, like geometry space, has no metric; the absolute size of a shape object is still undefined after the transform mapping has been applied. You can, however, compare the sizes of two shape objects that share the same transform object. For example, if two path shapes have the same geometry and reference the same transform object, they are the same size.
You typically use the transform's clip and mapping for application-specific purposes related to moving, masking, and distorting shapes within a document. With the transform clip you define what parts of the shape geometry are to be visible, and with the transform mapping you choose how to move, orient, and distort that visible part of the shape, usually in relation to other shapes in the same document.
Several shape objects can reference the same transform object. This allows you to move, scale, rotate, and otherwise change an entire group of shapes in unison, by altering a single transform mapping.
Some shape types have specific additional definitions of local space:
The transform object includes a reference to at least one view port object, and local space orients a shape within its view port. Local space is the coordinate system local to that view port--hence its name. Thus, the vase example in this section would have the same local coordinates--its bounding rectangle would have corners at about (0.0, 0.0) and (100.0, 200.0)--no matter how the view port itself might be scaled or distorted by its own mapping when it is converted to global space.
- Picture shapes, which consist of a hierarchy of other shapes, can have more than one transform object. In such a case, QuickDraw GX performs clipping and mapping operations on all transforms in turn from the bottom of the hierarchy to the top; the result of all those mapping transformations is considered local space for the shape. See the picture shapes chapter of Inside Macintosh: QuickDraw GX Graphics for information about the transform hierarchy in picture shapes.
- Glyph shapes can have mappings in their geometries (tangent array) and in their associated style objects (text faces). In such cases, QuickDraw GX applies those mappings before applying the clip and mapping of the transform object to convert the glyph shape to local space. See the glyph shapes and typographic styles chapters of Inside Macintosh: QuickDraw GX Typography for information about the tangent array and text face mappings.
The fact that local space is the interior coordinate space of a view port means that you can compare the sizes of two shapes in local space even if they do not share the same transform--as long as they share the same view port. If two shapes have the same dimensions in local space and their transforms reference the same view port, they are the same size regardless of the actual values in their geometries or transform mappings.